{% extends 'base.html' %}

{% block sidebar %}
	<div class="sidebar">
		<h3>Eventos</h3>
		<ul>
        	<li><a href="/user/events/approved">Meus Eventos Aprovados</a></li>
        	<li><a href="/user/events/nonapproved">Meus Eventos em Votação</a></li>
			<li><a href="/vote">Votar em outra timeline</a></li>
      	</ul>
	</div>
	
{% endblock %}

{% block content %}
	
<div class="content">
	<script>
		$("#voting_menu").addClass("selected");
	</script>  

	{% if message %}
		<div class="message">{{message}}</div>
	{% endif %}
		
	{% for g in groups %}
		<form action="" name="voting_form" id="voting_form" method="post">
			<input type="hidden" value="" name="positive" id="positive" />
			<input type="hidden" value="" name="kind" id="kind" />
			<input type="hidden" value="" name="id" id="id" />
			
			<div class="group">
				<div class="group_title">
					{% if g.date %}
						<div><span style="margin-bottom: 30px;">{{g.date}} : {{g.event}}</span></div>
					{% else %}
						<div><span style="margin-bottom: 30px;">{{g.event}}</span></div>
					{% endif %}
					
					{% if not g.voted %}
					<div>
						<img class="thumbs" src="/static/images/vote_up.gif" onclick="vote({{g.event.id}}, 1, 'event');" /> {{g.votes}} 
						<img class="thumbs" src="/static/images/vote_down.gif" alt="Não" onclick="vote({{g.event.id}}, 0, 'event');" />
					</div>				
					{% endif %}
				</div>
				{% for a in g.assets %}
				<table>
					<tr>
						<td class="w50">{{a.asset_type}}</td>
						<td class="w150">
							<div class="group_item">
								<a href='{{a.media}}' target="_blank">{{a.media}}</a>
								{% if a.caption %}
									<div>{{a.caption}}</div>
								{% endif %}
								{% if a.credit %}
									<div>{{a.credit}}</div>
								{% endif %}
							</div>	
						</td>
						<td>
							<div>
								<img class="thumbs" src="/static/images/vote_up.gif" onclick="vote({{a.id}}, 1, 'asset');" /> {{g.votes}}
							 </div>
							 <div>
								<img class="thumbs" src="/static/images/vote_down.gif" alt="Não" onclick="vote({{a.id}}, 0, 'asset');" />
							</div>
						</td>
					</tr>						
				</table>			
				{% endfor %}
				{% if not g.assets %}
					<div class="group_item">Não há recursos extras neste evento precisando de aprovação.</div>
				{% endif %}
			</div>
		</form>
	{% endfor %}
	
	{% if not groups %}
		<div class="message">Não há eventos precisando de aprovação.</div>
	{% endif %}

</div>

{% endblock %}
